import axios from 'axios'
const http = axios.create({
    timeout: 1000 * 100,
    // baseURL: 'http://134.64.248.186:9004/',
    // baseURL: 'http://134.64.248.186:9999/',
    // baseURL: 'http://192.168.1.101:9004/',
    // baseURL: 'http://192.168.1.105:9999/',
    // baseURL: 'http://192.168.110.54:9999/',
    baseURL: 'http://192.168.2.31:8089/screen/',
    headers: {
    'Content-Type': 'application/json; charset=utf-8'
    }
})
/****
 * get请求
 * ***/ 
const httpGet = function get(url, params = {}) {
  return new Promise((resolve, reject) => {
    http.get(url, { params: params })
      .then(res => {
        resolve(res.data)
      })
      .catch(err => {
        reject(err)
      })
  })
}

/***
 * post请求
 * ****/  
const httpPost = function post(url, data = {}) {
  return new Promise((resolve, reject) => {
    http.post(url, data)
      .then(res => {
        resolve(res.data)
      })
      .catch(err => {
        reject(err)
      })
  })
}
export {
  httpGet,
  httpPost
}